public class HandlerMappingIntrospector extends java.lang.Object implements CorsConfigurationSource
HandlerMapping
that would
serve a specific request.
Provides the following methods:
getMatchableHandlerMapping(HttpServletRequest)
— obtain a HandlerMapping
to check request-matching criteria against.
getCorsConfiguration(HttpServletRequest)
— obtain the CORS configuration for the
request.
Modifier and Type | Class and Description |
---|---|
private static class |
HandlerMappingIntrospector.RequestAttributeChangeIgnoringWrapper
Request wrapper that ignores request attribute changes.
|
Modifier and Type | Field and Description |
---|---|
private java.util.List<HandlerMapping> |
handlerMappings |
Constructor and Description |
---|
HandlerMappingIntrospector(ApplicationContext context)
Constructor that detects the configured
HandlerMapping s in the
given ApplicationContext or falls back on
"DispatcherServlet.properties" like the DispatcherServlet . |
Modifier and Type | Method and Description |
---|---|
CorsConfiguration |
getCorsConfiguration(HttpServletRequest request)
Return a
CorsConfiguration based on the incoming request. |
java.util.List<HandlerMapping> |
getHandlerMappings()
Return the configured HandlerMapping's.
|
MatchableHandlerMapping |
getMatchableHandlerMapping(HttpServletRequest request)
Find the
HandlerMapping that would handle the given request and
return it as a MatchableHandlerMapping that can be used to test
request-matching criteria. |
private static java.util.List<HandlerMapping> |
initDefaultHandlerMappings(ApplicationContext context) |
private static java.util.List<HandlerMapping> |
initHandlerMappings(ApplicationContext context) |
private final java.util.List<HandlerMapping> handlerMappings
public HandlerMappingIntrospector(ApplicationContext context)
HandlerMapping
s in the
given ApplicationContext
or falls back on
"DispatcherServlet.properties" like the DispatcherServlet
.private static java.util.List<HandlerMapping> initHandlerMappings(ApplicationContext context)
private static java.util.List<HandlerMapping> initDefaultHandlerMappings(ApplicationContext context)
public java.util.List<HandlerMapping> getHandlerMappings()
public MatchableHandlerMapping getMatchableHandlerMapping(HttpServletRequest request) throws java.lang.Exception
HandlerMapping
that would handle the given request and
return it as a MatchableHandlerMapping
that can be used to test
request-matching criteria.
If the matching HandlerMapping is not an instance of
MatchableHandlerMapping
, an IllegalStateException is raised.
request
- the current requestnull
java.lang.Exception
- if any of the HandlerMapping's raise an exceptionpublic CorsConfiguration getCorsConfiguration(HttpServletRequest request)
CorsConfigurationSource
CorsConfiguration
based on the incoming request.getCorsConfiguration
in interface CorsConfigurationSource
CorsConfiguration
, or null
if none